Ext.define('HIT.view.DealAbandonInvalid', {
    extend: 'Ext.window.Window',
    alias: 'widget.dealabandoninvalid',

    width: 651,
    resizable:false,       //不可调整大小
    plain: true,   //设置为true讲把窗体的body区域用一个透明背景来渲染
    modal : true,
    y : 80,
    id : 'DealAbandonInvalid',
    title: Share.T('红废票申请'),
    
    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            items: [ {
                xtype: 'form',
                width: 641,
                bodyPadding: 10,
                items: [ {
					xtype: 'hiddenfield',
					id: 'dealabandon-functionId',
					value: -1
                }, {
					xtype: 'hiddenfield',
					id: 'dealabandon-amount'
                }, {
					xtype: 'hiddenfield',
					id: 'dealabandon-cust-code'
                },{
					xtype: 'hiddenfield',
					id: 'voided_doc_id_win'
                }, {
				    xtype: 'fieldset',
				    height: 140,
				    width: 620,
				    layout: {
				        type: 'absolute'
				    },
				    title: Share.T('发票信息'),
				    items: [ {
                        xtype: 'button',
                        id:'dealabandon-testInfo',
                        x: 500,
                        y: 10,
                        text: Share.T('验证票据信息')
				    }, {
                        xtype: 'textfield',
                        id:'dealabandon-num',
                        x: 0,
                        y: 10,
                        width: 220,
                        style:'color:red;', 
                        allowBlank:false,
                        msgTarget  : 'side',
                        fieldLabel: Share.T('原发票代码'),
                        labelWidth: 90
				    }, {
                        xtype: 'textfield',
                        id:'dealabandon-numStart',
                        x: 250,
                        y: 10,
                        width: 220,
                        style:'color:red;', 
                        allowBlank:false,
                        msgTarget  : 'side',
                        fieldLabel: Share.T('原发票开始号'),
                        labelWidth: 90
				    }, {
                        xtype: 'textfield',
                        id:'dealabandon-numEnd',
                        x: 0,
                        y: 70,
                        width: 220,
                        fieldLabel: Share.T('原发票结束号'),
                        labelWidth: 90
				    }, {
                        xtype: 'datefield',
                        id:'dealabandon-startDate',
                        x: 0,
                        y: 40,
                        width: 220,
                        editable : false,
                        format:"Y-m-d",
                        fieldLabel: Share.T('原发票开始日期'),
                        labelWidth: 90
				    }, {
                        xtype: 'datefield',
                        id:'dealabandon-backDate',
                        x: 250,
                        y: 40,
                        width: 220,
                        editable : false,
                        format:"Y-m-d",
                        fieldLabel: Share.T('退回日期'),
                        labelWidth: 90
				    }, {
                        xtype: 'combobox',
                        id:'dealabandon-type',
                        editable : false,
                        x: 250,
                        y: 70,
                        width: 220,
                        queryMode: 'local',
                        fieldLabel: Share.T('标记状态'),
                        labelWidth: 90,
                        store: new Ext.data.Store({
                        	proxy: {
								type: 'ajax', 
								url : ctx + '/getAbandonType',
								params:{},
								reader: {
									type: 'json', 
									totalProperty: '', 
									root: '' 
								}
                        	},
							fields:['text','value'], 
							autoLoad : true
                        }),
					    displayField: 'text',
					    valueField: 'value',
					    listeners:{
					    	expand : function(field, e) {
								var store = field.store; 
								if(!field.forceAll){
									store.filterBy(function(record,id){   
										var text = record.get(field.valueField); 
										return (text.indexOf('0'));   
									});
								}
							},
				        	select: function(combo,records,e){
				        		var val = records[0].raw.value;
				        		if(val >10){
				        			Ext.getCmp("dealabandon-testInfo").setDisabled(true);  
				        			Ext.getCmp("dealabandon-ok").setDisabled(false);
				        			Ext.getCmp("deal-delabled-type").setDisabled(false);
				        		}else{
				        			Ext.getCmp("dealabandon-testInfo").setDisabled(false);  
				        			Ext.getCmp("dealabandon-ok").setDisabled(true);
				        			Ext.getCmp("deal-delabled-type").setDisabled(true);
				        		}
				        		if(val == 1){//普通发票隐藏“进出口发票”输入框
				        			Ext.getCmp("dealabandon-redInfo").hide();
				        		} else {//进出口发票隐藏“进出口发票”输入框
				        			Ext.getCmp("dealabandon-redInfo").show();
				        		}
				        	}
				        },
					    value :'1'
				    } ]  
                }, {
                    xtype: 'fieldset',
                    id:'dealabandon-redInfo',
                    height: 150,
                    width: 620,
                    hidden : true, 
                    layout: {
                        type: 'absolute'
                    },
                    title: Share.T('红票信息'),
                    items: [ {
                        xtype: 'textfield',
                        id:'dealabandon-redCode',
                        x:0,
                        y:0,
                        width: 220,
                        fieldLabel: Share.T('红票代码'),
                        labelWidth: 90
                    }, {
                        xtype: 'textfield',
                        id:'dealabandon-redNum',
                        x: 0,
                        y: 40,
                        width: 220,
                        fieldLabel: Share.T('红票号码'),
                        labelWidth: 90
                    }, {
                        xtype: 'datefield',
                        id:'dealabandon-redDate',
                        x: 250,
                        y: 0,
                        width: 220,
                        fieldLabel: Share.T('红票日期'),
                        editable : false,
                        format:"Y-m-d",
                        labelWidth: 90
                    }, {
                        xtype: 'numberfield',
                        id:'dealabandon-redAmount',
                        hideTrigger : true,
						maxValue : 9999999999999,
						minValue : 0.01,
                        x: 250,
                        y: 40,
                        width: 220,
                        fieldLabel: Share.T('红票金额'),
                        msgTarget  : 'side',
                        labelWidth: 90
                    }, {
                        xtype: 'textfield',
                        id:'dealabandon-redNotice',
                        y: 80,
                        width: 220,
                        maxLength : 200,
                        msgTarget  : 'side',
                        fieldLabel: Share.T('红字通知单号码'),
                        labelWidth: 90
                    } ]
                }, {//加了个panel 调整布局 by Luo
                	xtype: 'panel',
                	height: 35,
                	border:false,
                	layout: {
                        type: 'absolute'
                    },
                    items:[ {
                        xtype: 'textfield',
                        id:'dealabandon-note',
                        x: 12,
                        width: 607,
                        fieldLabel: Share.T('备注'),
                        labelWidth: 50
                    } ]
                }, {
                    xtype: 'fieldset',
                    height: 90,
                    width: 620,
                    layout: {
                        type: 'absolute'
                    },
                    title: Share.T('票据信息'),
                    items: [ {
                        xtype: 'label',
                        x: 0,
                        y: 0,
                        height: 20,
                        width: 50,
                        text: Share.T('单据号')+":"
                    }, {
                        xtype: 'label',
                        x: 0,
                        y: 30,
                        text: Share.T('客户名称')+":"
                    }, {
                        xtype: 'label',
                        x: 350,
                        y: 0,
                        text: Share.T('原发票价税合计')+":"
                    }, {
//                        xtype: 'label',
//                        x: 350,
//                        y: 30,
//                        text: Share.T('原发票类型')+":"
                        xtype: 'combobox',
    	                editable : false,
    	                disabled: true,
                        x: 350,
                        y: 30,
                        fieldLabel: Share.T('原发票类型'),
                        id:'deal-delabled-type',
                        labelWidth:80,
                        width:195,
                        msgTarget  : 'side',
                        //allowBlank:false,
                        //blankText:Share.T('票据类型不能为空'),
                        store: new Ext.data.JsonStore({  
        					proxy: { 
            	                type: 'ajax', 
            	                url : ctx + '/getInvoiceType',
            	                params:{        	                	
            	                },
            	                reader: { 
            	                    type: 'json', 
            	                    totalProperty: '', 
            	                    root: '' 
            	                } 
            	             }, 
            	            fields:['text','value'], 
            	            autoLoad:true 
    			        }),
    			        displayField: 'text',
    			        valueField: 'value',
                    }, {
                        xtype: 'label',
                        id:'dealabandon-document-no',
                        x: 80,
                        y: 0,
                        width: 100,
                        text: '--'
                    }, {
                        xtype: 'label',
                        id:'dealabandon-cust-name',
                        x: 80,
                        y: 30,
                        width:250,
                        text: '  --'
                    }, {
                        xtype: 'label',
                        id:'dealabandon-amount-cur-total',
                        x: 450,
                        y: -1,
                        width: 60,
                        text: '--'
                    }, {
                        xtype: 'label',
                        id:'dealabandon-document-type',
                        x: 450,
                        y: 30,
                        text: ''
                    } ]
                } ]
            } ],
            buttons   : [ {
			    xtype: 'button',
			    id:'dealabandon-resub',
			    hidden : true,
			    text: Share.T('重新提交')
            }, {
			    xtype: 'button',
			    id:'dealabandon-ok',
				disabled: true,
			    text: Share.T('保存')
            }, {
			    xtype: 'button',
			    id:'dealabandon-cancel',
			    text: Share.T('取消')
            } ]
        });
        me.callParent(arguments);
    }
});